﻿/* 
 * Since 2008 - 2012
 */

package com.hh.bss.auth.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

import com.hh.bss.auth.dao.*;
import com.hh.bss.auth.entity.*;
import com.hh.bss.auth.service.*;
import com.hh.bss.auth.vo.query.*;
import com.hh.bss.base.*;
import com.hh.bss.common.page.*;
import com.hh.bss.common.page.impl.*;
import com.hh.bss.util.*;




@Service
@Transactional
public class SystemRoleDataControlServiceImpl extends BaseBusinessService<SystemRoleDataControl,java.lang.Integer>  implements SystemRoleDataControlService<SystemRoleDataControl,java.lang.Integer>{

	private SystemRoleDataControlDao systemRoleDataControlDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setSystemRoleDataControlDaoImpl(SystemRoleDataControlDao dao) {
		this.systemRoleDataControlDao = dao;
	}
	public EntityDao getEntityDao() {
		return this.systemRoleDataControlDao;
	}
	
	@Transactional(readOnly=true)
	public Page findPage(SystemRoleDataControlQuery query) {
		return systemRoleDataControlDao.findPage(query);
	}
	public void batchsave(Integer roleId, List l) {
		// TODO Auto-generated method stub
		SystemRoleDataControl systemRoleDataControl=null;
		for(int i=0;l!=null&&i<l.size();i++){
			systemRoleDataControl=(SystemRoleDataControl)l.get(i);
			if (systemRoleDataControl.getId()==null||systemRoleDataControl.getId().intValue()==0){
				systemRoleDataControl.setRoleId(roleId);
				systemRoleDataControl.setCreateDt(new Date());
				systemRoleDataControlDao.save(systemRoleDataControl);
			}else{
				systemRoleDataControlDao.update(systemRoleDataControl);
			}
			systemRoleDataControlDao.flush();
		}
	}
	
}
